<template>
  <div class="home">
    <Header />
    <Info :infoData="infoData" />
    <CaseNum :caseNumData="caseNumData" />
    <Map />
    <TreeChart />
    <News :newsData="newsData" />
    <Footer />
  </div>
</template>

<script>
import Header from "../components/Header.vue";
import Info from "../components/Info.vue";
import CaseNum from "../components/CaseNum.vue";
import Map from "../components/Map.vue";
import TreeChart from "../components/TreeChart.vue";
import News from "../components/News.vue";
import Footer from "../components/Footer.vue";
export default {
  name: "Home",
  components: {
    Header,
    Info,
    CaseNum,
    Map,
    TreeChart,
    News,
    Footer,
  },
  data() {
    return {
      infoData: {},
      caseNumData: {},
      newsData: [],
    };
  },
  created() {
    this.$api
      .getDataInfo({
        key: "2f8f047cd87ff85c48aa8b3f99fd2065",
      })
      .then((res) => {
        console.log(res);
        this.newsData = res.newslist[0].news;
        this.infoData = {
          note1: res.newslist[0].desc.note1,
          note2: res.newslist[0].desc.note2,
          note3: res.newslist[0].desc.note3,
          remark1: res.newslist[0].desc.remark1,
          remark2: res.newslist[0].desc.remark2,
          remark3: res.newslist[0].desc.remark3,
        };
        this.caseNumData = {
          modifyTime: res.newslist[0].desc.modifyTime,
          //现有确诊
          currentConfirmedCount: res.newslist[0].desc.currentConfirmedCount,
          //无症状
          seriousCount: res.newslist[0].desc.seriousCount,
          suspectedIncr: res.newslist[0].desc.suspectedIncr,
          confirmedCount: res.newslist[0].desc.confirmedCount,
          deadCount: res.newslist[0].desc.deadCount,
          curedCount: res.newslist[0].desc.curedCount,

          // 相比昨天
          currentConfirmedIncr: res.newslist[0].desc.currentConfirmedIncr,
          seriousIncr: res.newslist[0].desc.seriousIncr,
          confirmedIncr: res.newslist[0].desc.confirmedIncr,
          deadIncr: res.newslist[0].desc.deadIncr,
          curedIncr: res.newslist[0].desc.curedIncr,
        };
      });
  },
};
</script>
